<template>
  <div>
    <zm-panel title="影院详情" :visible.sync="value" @change="close">
      <zm-table-data :data="tableParams.data" :columns="columns" :fetch="loadList" :table-params="tableParams" :show-page="true"></zm-table-data>
      <div slot="footer" class="tr">
        <el-button @click="close">关 闭</el-button>
      </div>
    </zm-panel>
  </div>
</template>

<script>
import panelMixin from '@/mixins/panelMixin'
import tableMixin from '@/mixins/zmTableMixin'
import cloudApis from '@/api/src/cloud'
import { cinemaColumns } from './const'

export default {
  components: { },
  mixins: [panelMixin, tableMixin],
  props: {
    isNew: {
      type: String,
      default: '0'
    },
    id: {
      type: String,
      default: ''
    },
    obj: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data () {
    return {

    }
  },
  computed: {
    columns () {
      return cinemaColumns(this)
    },
    form: {
      get () {
        return this.obj
      }
    }
  },
  created () {
  },
  methods: {
    async loadList () {
      if (this.isNew === '0') {
        if (this.obj.relationId !== '-1' && this.obj.relationId && this.obj.relationId.length > 0) {
          const params = this.obj.relationType === '1' ? { cinemaGroupId: this.obj.relationId } : { ids: this.obj.relationId }
          const _res = await cloudApis.getCinemaPageList(params)
          this.initialTableData(_res.list, _res.count)
        }
      } else {
        const params = { ids: this.id }
        const _res = await cloudApis.getCinemaPageList(this.assignQuery(params))
        this.initialTableData(_res.list, _res.count)
      }
    }
  }
}
</script>
